using System;

namespace Common {
    public class Result<T> {
        public bool IsSuccess;
        public string Message;
        public T Data;


        public static Result<T> Ok(T data) {
            return new Result<T>() {
                IsSuccess = true,
                Data = data
            };
        }

        public static Result<T> Ok() {
            return new Result<T>(){IsSuccess = true};
        }
        
        public static Result<T> Ok(string msg) {
            return new Result<T>() {
                IsSuccess = true,
                Message = msg
            };
        }
        
        public static Result<T> Ok(String msg, T data) {
            return new Result<T>() {
                IsSuccess = true,
                Message = msg,
                Data = data
            };
        }

        public static Result<T> Error() {
            return new Result<T>(){IsSuccess = false};
        }
        
        public static Result<T> Error(T data) {
            return new Result<T>() {
                IsSuccess = false,
                Data = data
            };
        }
        
        public static Result<T> Error(String msg) {
            return new Result<T>() {
                IsSuccess = false,
                Message = msg
            };
        }

        public static Result<T> Error(String msg, T data) {
            return new Result<T>() {
                IsSuccess = false,
                Message = msg,
                Data = data
            };
        }
    }
}